package com.google.code.tutorials.java.spring.data.jpa.repository.custom;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.criteria.CriteriaQuery;

import com.google.code.tutorials.java.spring.data.jpa.domain.Person;

public class CustomRepositoryImpl implements CustomRepository {
	
	@PersistenceContext
	private EntityManager em;
	
	public List<Person> myCustomBatchOperation() {
		CriteriaQuery<Person> criteriaQuery = em.getCriteriaBuilder().createQuery(Person.class);
		criteriaQuery.select(criteriaQuery.from(Person.class));
		return em.createQuery(criteriaQuery).getResultList();
	}

	public void setEm(EntityManager em) {
		this.em = em;
	}
}
